const Sequelize = require('sequelize');

/**
 * 商品图片
 */
exports.GoodsesDetails = {
    goods_id: {type: Sequelize.STRING(160), allowNull: false, comments: '商品编号'},
    date: {type: Sequelize.STRING(160), allowNull: false, comments: '缓存时间'},
    images_data: {type: Sequelize.TEXT, allowNull: true, comments: '图片数据'},
    content_data: {type: Sequelize.TEXT, allowNull: true, comments: '详情数据'},
    coupons_data: {type: Sequelize.TEXT, allowNull: true, comments: '优惠券数据'},
    recommend_data: {type: Sequelize.TEXT, allowNull: true, comments: '推荐数据'}
}

/**
 * 联盟商品
 */
exports.Goodses = {
    type: {
        type: Sequelize.STRING(50),
        allowNull: true,
        defaultValue: 'ALi',
        unique: 'type_auction_id',
        comments: '淘宝，京东, 拼多多'
    },
    rootCatId: {type: Sequelize.INTEGER, allowNull: true, comments: '主分类编号'},
    leafCatId: {type: Sequelize.INTEGER, allowNull: true, comments: '子分类编号'},

    userType: {type: Sequelize.INTEGER, allowNull: true, comments: '店铺类型 [0 淘宝, 1 天猫]'},
    shopTitle: {type: Sequelize.STRING(190), allowNull: true, comments: '店铺名'},

    pictUrl: {type: Sequelize.STRING(190), allowNull: true, comments: '商品图片'},
    title: {type: Sequelize.STRING(190), allowNull: true, comments: '商品名'},
    auctionId: {type: Sequelize.STRING(160), allowNull: true, unique: 'type_auction_id', comments: '商品编号'},
    auctionUrl: {type: Sequelize.STRING(190), allowNull: true, comments: '商品地址'},

    reservePrice: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '原价'},
    zkPrice: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '折扣价格'},
    quanPrice: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '券后价'},

    activityId: {type: Sequelize.STRING(190), allowNull: true, comments: '活动编号'},
    couponType: {type: Sequelize.STRING(50), allowNull: true, comments: '劵类型'},
    couponAmount: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '优惠劵金额'},
    couponEffectiveEndTime: {type: Sequelize.STRING(30), allowNull: true, comments: '优惠劵结束时间'},
    couponEffectiveStartTime: {type: Sequelize.STRING(30), allowNull: true, comments: '优惠劵开始时间'},
    couponInfo: {type: Sequelize.STRING(30), allowNull: true, comments: '优惠劵说明'},
    couponLeftCount: {type: Sequelize.INTEGER, allowNull: true, comments: '券剩余数量'},
    couponTotalCount: {type: Sequelize.INTEGER, allowNull: true, comments: '券总共数量'},
    couponStartFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '最少使用金额'},
    couponLink: {type: Sequelize.STRING(190), allowNull: true, comments: '活动加密编号'},
    couponLinkTaoToken: {type: Sequelize.STRING(190), allowNull: true, comments: ''},

    sellerId: {type: Sequelize.STRING(160), allowNull: true, comments: '卖家编号'},
    nick: {type: Sequelize.STRING(190), allowNull: true, comments: '卖家昵称'},
    provcity: {type: Sequelize.STRING(190), allowNull: true, comments: '地区'},
    dsr: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '店铺评分'},

    dayLeft: {type: Sequelize.INTEGER, allowNull: true, comments: '剩余天数'},

    commission: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '佣金比例'},
    commissionType: {
        type: Sequelize.STRING(30),
        allowNull: true,
        comments: '佣金类型(1定向计划 2高拥 3通用 4营销计划, MKT表示营销计划，SP表示定向计划，COMMON表示通用计划)'
    },

    tkRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '通用佣金比例'},
    tkCommFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '通用佣金'},

    tkCommonRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '无高佣通用佣金比例'},
    tkCommonFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '无高佣通用佣金'},

    tkFinalRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: ''},
    tkFinalFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: ''},

    queqiaoRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '鹊桥佣金比例'},
    queqiaoFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '鹊桥佣金'},

    jihuaRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '营销计划比例'},
    jihuaFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '营销计划佣金'},
    jihuaLink: {type: Sequelize.STRING(190), allowNull: true, comments: '营销计划链接'},
    jihuaShenhe: {type: Sequelize.STRING(30), allowNull: true, comments: '营销计划审核'},

    eventCampId: {type: Sequelize.STRING(190), allowNull: true, comments: '自动定向最高申请campId'},
    eventKeeperid: {type: Sequelize.STRING(190), allowNull: true, comments: '自动定向最高申请keeperid'},
    eventRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '自动定向最高比例'},
    eventFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '自动定向最高佣金'},
    eventDayLeft: {type: Sequelize.INTEGER, allowNull: true, comments: '自动定向最高剩余天数'},

    totalNum: {type: Sequelize.INTEGER, allowNull: true, comments: '月推广件数'},
    totalFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '月支出佣金'},
    biz30day: {type: Sequelize.INTEGER, allowNull: true, comments: '30天销量'},

    isBizActivity: {type: Sequelize.INTEGER(1), allowNull: true, comments: ''},
    tkMktStatus: {type: Sequelize.INTEGER(1), allowNull: true, comments: '是否营销计划'},
    includeDxjh: {type: Sequelize.INTEGER(1), allowNull: true, comments: ''},
    infoDxjh: {type: Sequelize.STRING(190), allowNull: true, comments: ''},

    isNew: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是今日上新'},
    isHot: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否热推商品'},
    isJhs: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是聚划算'},
    isTqg: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是淘抢购'},
    isJYJ: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是极有家'},
    isAli: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是阿里'},
    isPP: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是品牌商品'},

    isYFX: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否有运费险'},
    isJP: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否金牌卖家'},
    isHT: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否海淘'},

    is30: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否白菜价'},
    is99: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否9.9包邮'},
    is199: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否19.9包邮'},

    intro: {type: Sequelize.STRING(190), allowNull: true, comments: '推广描述'},

    source: {type: Sequelize.STRING(190), allowNull: true, comments: '来源'},
    feature: {type: Sequelize.INTEGER(6), allowNull: false, defaultValue: 0, comments: '推荐指数'},
    order_by: {type: Sequelize.INTEGER(9), allowNull: false, defaultValue: 0},
    status: {
        type: Sequelize.STRING(30), allowNull: false, defaultValue: 'Pending',
        validate: {isIn: [['Pending', 'Active', 'Deactivated']]}
    },
    ext_data: {type: Sequelize.TEXT, allowNull: true, comments: '扩展数据'}
}

/**
 * 联盟商品
 */
exports.RemoveGoodses = {
    type: {
        type: Sequelize.STRING(50),
        allowNull: true,
        defaultValue: 'ALi',
        comments: '淘宝，京东, 拼多多'
    },
    rootCatId: {type: Sequelize.INTEGER, allowNull: true, comments: '主分类编号'},
    leafCatId: {type: Sequelize.INTEGER, allowNull: true, comments: '子分类编号'},

    userType: {type: Sequelize.INTEGER, allowNull: true, comments: '店铺类型 [0 淘宝, 1 天猫]'},
    shopTitle: {type: Sequelize.STRING(190), allowNull: true, comments: '店铺名'},

    pictUrl: {type: Sequelize.STRING(190), allowNull: true, comments: '商品图片'},
    title: {type: Sequelize.STRING(190), allowNull: true, comments: '商品名'},
    auctionId: {type: Sequelize.STRING(160), allowNull: true, comments: '商品编号'},
    auctionUrl: {type: Sequelize.STRING(190), allowNull: true, comments: '商品地址'},

    reservePrice: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '原价'},
    zkPrice: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '折扣价格'},
    quanPrice: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '券后价'},

    activityId: {type: Sequelize.STRING(190), allowNull: true, comments: '活动编号'},
    couponType: {type: Sequelize.STRING(50), allowNull: true, comments: '劵类型'},
    couponAmount: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '优惠劵金额'},
    couponEffectiveEndTime: {type: Sequelize.STRING(30), allowNull: true, comments: '优惠劵结束时间'},
    couponEffectiveStartTime: {type: Sequelize.STRING(30), allowNull: true, comments: '优惠劵开始时间'},
    couponInfo: {type: Sequelize.STRING(30), allowNull: true, comments: '优惠劵说明'},
    couponLeftCount: {type: Sequelize.INTEGER, allowNull: true, comments: '券剩余数量'},
    couponTotalCount: {type: Sequelize.INTEGER, allowNull: true, comments: '券总共数量'},
    couponStartFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '最少使用金额'},
    couponLink: {type: Sequelize.STRING(190), allowNull: true, comments: '活动加密编号'},
    couponLinkTaoToken: {type: Sequelize.STRING(190), allowNull: true, comments: ''},

    sellerId: {type: Sequelize.STRING(160), allowNull: true, comments: '卖家编号'},
    nick: {type: Sequelize.STRING(190), allowNull: true, comments: '卖家昵称'},
    provcity: {type: Sequelize.STRING(190), allowNull: true, comments: '地区'},
    dsr: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '店铺评分'},

    dayLeft: {type: Sequelize.INTEGER, allowNull: true, comments: '剩余天数'},

    commission: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '佣金比例'},
    commissionType: {
        type: Sequelize.STRING(30),
        allowNull: true,
        comments: '佣金类型(1定向计划 2高拥 3通用 4营销计划, MKT表示营销计划，SP表示定向计划，COMMON表示通用计划)'
    },

    tkRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '通用佣金比例'},
    tkCommFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '通用佣金'},

    tkCommonRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '无高佣通用佣金比例'},
    tkCommonFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '无高佣通用佣金'},

    tkFinalRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: ''},
    tkFinalFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: ''},

    queqiaoRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '鹊桥佣金比例'},
    queqiaoFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '鹊桥佣金'},

    jihuaRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '营销计划比例'},
    jihuaFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '营销计划佣金'},
    jihuaLink: {type: Sequelize.STRING(190), allowNull: true, comments: '营销计划链接'},
    jihuaShenhe: {type: Sequelize.STRING(30), allowNull: true, comments: '营销计划审核'},

    eventCampId: {type: Sequelize.STRING(190), allowNull: true, comments: '自动定向最高申请campId'},
    eventKeeperid: {type: Sequelize.STRING(190), allowNull: true, comments: '自动定向最高申请keeperid'},
    eventRate: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '自动定向最高比例'},
    eventFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '自动定向最高佣金'},
    eventDayLeft: {type: Sequelize.INTEGER, allowNull: true, comments: '自动定向最高剩余天数'},

    totalNum: {type: Sequelize.INTEGER, allowNull: true, comments: '月推广件数'},
    totalFee: {type: Sequelize.DECIMAL(10, 2), allowNull: true, comments: '月支出佣金'},
    biz30day: {type: Sequelize.INTEGER, allowNull: true, comments: '30天销量'},

    isBizActivity: {type: Sequelize.INTEGER(1), allowNull: true, comments: ''},
    tkMktStatus: {type: Sequelize.INTEGER(1), allowNull: true, comments: '是否营销计划'},
    includeDxjh: {type: Sequelize.INTEGER(1), allowNull: true, comments: ''},
    infoDxjh: {type: Sequelize.STRING(190), allowNull: true, comments: ''},

    isNew: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是今日上新'},
    isHot: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否热推商品'},
    isJhs: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是聚划算'},
    isTqg: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是淘抢购'},
    isJYJ: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是极有家'},
    isAli: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是阿里'},
    isPP: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否是品牌商品'},

    isYFX: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否有运费险'},
    isJP: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否金牌卖家'},
    isHT: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否海淘'},

    is30: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否白菜价'},
    is99: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否9.9包邮'},
    is199: {type: Sequelize.INTEGER(1), allowNull: false, defaultValue: 0, comments: '是否19.9包邮'},

    intro: {type: Sequelize.STRING(190), allowNull: true, comments: '推广描述'},

    source: {type: Sequelize.STRING(190), allowNull: true, comments: '来源'},
    feature: {type: Sequelize.INTEGER(6), allowNull: false, defaultValue: 0, comments: '推荐指数'},
    order_by: {type: Sequelize.INTEGER(9), allowNull: false, defaultValue: 0},
    status: {
        type: Sequelize.STRING(30), allowNull: false, defaultValue: 'Pending',
        validate: {isIn: [['Pending', 'Active', 'Deactivated']]}
    },
    ext_data: {type: Sequelize.TEXT, allowNull: true, comments: '扩展数据'},

    deleted_at: {type: Sequelize.DATE, allowNull: true, comments: '删除时间'}
}

/**
 * 商品抓取日志
 */
exports.CaptureLogs = {
    total_count: {type: Sequelize.INTEGER, allowNull: false, defaultValue: 0, comments: '总数量'},
    noexist: {type: Sequelize.INTEGER, allowNull: false, defaultValue: 0, comments: '上一次存在'},
    add_count: {type: Sequelize.INTEGER, allowNull: false, defaultValue: 0, comments: '添加数量'},
    update_count: {type: Sequelize.INTEGER, allowNull: false, defaultValue: 0, comments: '添加数量'},
    type: {type: Sequelize.STRING(190), allowNull: true, comments: '类型'},
    sources: {type: Sequelize.STRING(190), allowNull: true, comments: '来源 [淘宝联盟, 轻淘客]'},
    ext_data: {type: Sequelize.TEXT, allowNull: true, comments: '扩展数据'}
}